<template>
  <el-input
    @change="onChange"
    @input="onInput"
    clearable
    v-bind="$attrs"
  ></el-input>
  <!-- v-on="$listeners" -->
</template>

<script>
export default {
  methods: {
    onInput(e) {
      e = e.replace(/^\./, "0.");
      e = e.replace(/(?<=.+\..*)\./, "");
      e = e.replace(/[^0-9\\.]/g, "");

      this.value = e;
      this.$emit("input", e);
      // this.$emit("change", this.model);

    //  this.onChange(temp);
    },
    onChange(e){
      e = Number(e).toFixed(2);
      e = Number(e);
      this.value = e;

      this.$emit("input", e);
      this.$emit("change", e);
    }

  },
};
</script>

<style></style>
